package com.qpx.springbootdemodashuju.web;


import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.qpx.springbootdemodashuju.entity.User;
import com.qpx.springbootdemodashuju.service.IUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Mht
 * @since 2019-12-25
 */
@Controller
@RequestMapping("/user")
@Slf4j
public class UserController {

    @Autowired
    IUserService iUserService;

    @RequestMapping("/list")
    public String list(ModelMap modelMap){
        Wrapper<User> wrapper = new EntityWrapper();
        List<User> list = iUserService.selectList(wrapper);
        log.info("list--->{}", JSON.toJSONString(list));
        modelMap.put("users",list);
        return "index";
    }

}
